var rewardsPublic = function() {
};
rewardsPublic.prototype = {
    buildListDomOfMobileByDataList:function (options) {
        var dataList=options.dataList||[];
        var imgBasePath=options.imgBasePath||"./";
        var pageTargetType=options.pageTargetType||"_blank";
        var $loading=$(options.loadingSelector);
        var arrTemp=[];
        var dataCount=0;
        $.each(dataList,function (idx, obj) {
            dataCount++;
            var hoseTypeText="";
            hoseTypeText+=obj['houseTypeOne']===""?"":obj['houseTypeOne']+"室";
            hoseTypeText+=obj['houseTypeTwo']===""?"&nbsp;":obj['houseTypeTwo']+"厅&nbsp;";
            var houseAreaText=obj['houseFloorArea']===""?"":obj['houseFloorArea']+"m²&nbsp;&nbsp;";//建筑面积
            var orientation=obj['houseOrientations']?obj['houseOrientations']:"";//朝向
            var typicalDom=houseAreaText+hoseTypeText+orientation;
            var isRecommended=obj['isRecommended']?obj['isRecommended']:"";
            var isNew=obj['isNew']?obj['isNew']:"";
            isRecommended=isRecommended==="1"?'<li class="esheyi-recommended">舍艺推荐</li>':"";
            isNew=isNew==="1"?'<li class="recently-added">最近新增</li>':"";
            var rewardStatus=obj['rewardStatus']?obj['rewardStatus']:"";
            var rewardTitle=obj['rewardTitle']?obj['rewardTitle']:"";
            var listingPriceDom=obj['quotePrice']===""? "" : obj['quotePrice']+'万';
            var unitPriceDom=obj['unitPrice']===""?"" : '<span class="unit-price">'+obj['unitPrice']+'元/m²</span>';
            if(rewardStatus==="1"){
                rewardStatus='<p class="reward-red">悬赏中</p>';
                rewardTitle='<span>'+rewardTitle+'</span>';
                listingPriceDom='<i>'+listingPriceDom+'</i>';
                typicalDom='<span>'+typicalDom+'</span>';
            }else if(rewardStatus==="2"){
                rewardStatus='<p class="reward-green">已完成</p>';
                rewardTitle='<span class="saleTitle-gray">'+rewardTitle+'</span>';
                listingPriceDom='<i class="total-price">'+listingPriceDom+'</i>';
                typicalDom='<span class="gray">'+typicalDom+'</span>';
                unitPriceDom="";
            }else if(rewardStatus==="3"){
                rewardStatus='<p class="reward-gray">已取消</p>';
                rewardTitle='<span class="saleTitle-gray">'+rewardTitle+'</span>';
                listingPriceDom='<i class="total-price">'+listingPriceDom+'</i>';
                typicalDom='<span class="gray">'+typicalDom+'</span>';
                unitPriceDom="";
            };
            var addressDom=obj['villageName']?'<span class="address">'+obj['villageName']+'</span>':"";
            var tempDom='<li class="panel">'+
                                '<a href=./houseDetail.html?id='+obj['rewardId']+' target='+pageTargetType+'>'+
                                    '<div class="cover-image">'+rewardStatus+'<img src="'+imgBasePath+obj['coverPhoto']+'"></div>'+
                                    '<div class="house-info">'+
                                        '<h5>'+rewardTitle+'</h5>'+
                                        '<div class="clearfix">'+typicalDom+listingPriceDom+'</div>'+
                                        '<p class="clearfix">'+addressDom+unitPriceDom+'</p>'+
                                        '<ul class="features clearfix">'+isRecommended+isNew+'</ul>'+
                                    '</div>'+
                                '</a>'+
                            '</li>';
            arrTemp.push(tempDom) ;
        });
        $loading.length>0?(dataList.length && dataList.length<10 || dataCount<10 ? $loading.text("已经没有更多信息了").show():$loading.text("").hide()):"无点击加载选择器";
        return arrTemp.join("");
    }
};
window.rewardsPublic = new rewardsPublic();
